#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
const int mod=1e9+7;

struct node
{
	long long sqr[3][3]; 
};

node operator*(node a,node b)
{
	node c;
	c.sqr[1][1]=(a.sqr[1][1]*b.sqr[1][1]%mod+a.sqr[1][2]*b.sqr[2][1]%mod)%mod;
	c.sqr[1][2]=(a.sqr[1][1]*b.sqr[1][2]%mod+a.sqr[1][2]*b.sqr[2][2]%mod)%mod;
	c.sqr[2][1]=(a.sqr[2][1]*b.sqr[1][1]%mod+a.sqr[2][2]*b.sqr[2][1]%mod)%mod;
	c.sqr[2][2]=(a.sqr[2][1]*b.sqr[1][2]%mod+a.sqr[2][2]*b.sqr[2][2]%mod)%mod;
	return c;
}

node quickpow(node a,long long n)
{
	node re=a;
	while(n!=0)
	{
		if(n%2==1)
		{
			re=re*a;
		}
		a=a*a;
		n=n/2;
	}
	return re;
}

int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    
    long long n;
    cin >> n;
    if(n==0)
    {
    	cout << "0" << endl;
	}
	else if(n==1)
	{
		cout << "1" << endl;
	}
	else
	{
    node a;
    a.sqr[1][1]=a.sqr[1][2]=a.sqr[2][1]=1;
    a.sqr[2][2]=0;
    node b=quickpow(a,n-2);
    cout << b.sqr[1][1] << endl;
    } 
    return 0;
}
